package com.example.spring_config.controller;

import com.example.spring_config.bean.Dog;
import com.example.spring_config.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Arrays;
import java.util.List;


@Controller
public class MyController {

    @RequestMapping("/toPage/{filename}/{name}")
    public String hello(@PathVariable String name,@PathVariable String filename){
        return filename+"/"+name;
    }

    @RequestMapping("/test")
    @ResponseBody
    public List<Dog> getMap(){

        return Arrays.asList(new Dog(1,"广子1号"),
                new Dog(2,"广子2号"),
                new Dog(3,"广子3号"),
                new Dog(4,"广子4号"));
    }
    @RequestMapping("/test2")
    @ResponseBody
    public List<User> getUser(){

        return Arrays.asList(new User("1","1","1","1"),
                new User("2","2","2","2"),
                new User("3","3","3","3"),
                new User("4","4","4","4"),
                new User("5","5","5","5"));
    }



}
